<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增设备库房信息')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
    <div class="main-content">
        <form id="form-user-add" class="form-horizontal">
            <h4 class="form-header h4">设备信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">设备id：</label>
                        <div class="col-sm-8">
                            <input name="device_id" placeholder="请输入设备id" class="form-control" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">设备名称：</label>
                        <div class="col-sm-8">
                            <input name="device_name" id="device_name" type="text" placeholder="请输入设备名称" class="form-control"required>
                        </div>
                    </div>
                </div>
            </div><div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">设备类型：</label>
                    <div class="col-sm-8">
                        <input name="device_type"  placeholder="请输设备类型" class="form-control" type="text" maxlength="30" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">保养周期：</label>
                    <div class="col-sm-8">
                        <input name="maintenance_cycle" id="cargo_area_id" type="text" placeholder="请输入设备的保养周期" class="form-control">
                    </div>
                </div>
            </div>
        </div><div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">保养范围：</label>
                    <div class="col-sm-8">
                        <input name="maintenance_range" placeholder="请输入设备的保养范围" class="form-control" type="text" maxlength="30" >
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">是否锁定：</label>
                    <div class="col-sm-8">
                        <label class="toggle-switch switch-solid">
                            <input type="checkbox" id="locked" >
                            <span></span>
                        </label>
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>
      
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script>
	    var prefix =ctx + "device/basDevice";
        function submitHandler() {
	        if ($.validate.form()) {
	        	var data = $("#form-user-add").serializeArray();
	        	var locked = $("input[id='locked']").is(':checked') == true ? "Y" : "N";
	        	data.push({"name": "locked", "value": locked});
	        	$.operate.saveTab(prefix + "/add", data);
	        }
	    }
    </script>
</body>
</html>